package com.iflytek.day26;


import java.io.*;

public class _10_CopyMp4Demo {
  public static void main(String[] args) throws IOException {

    // 复制视频
    // method1();
    method2();

  }

  // 字节缓冲流一次读写一个字节
  public static void method1() throws IOException {
    BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\sias\\卡点电子剪辑超级英雄相册.mp4"));
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("src\\com\\iflytek\\day26\\卡点电子剪辑超级英雄相册.mp4"));

    int by;
    while ((by = bis.read()) != -1) {
      bos.write(by);
    }

    bos.close();
    bis.close();
  }

  // 字节缓冲流一次读写一个字节数组
  public static void method2() throws IOException {
    BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\sias\\卡点电子剪辑超级英雄相册.mp4"));
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("src\\com\\iflytek\\day26\\卡点电子剪辑超级英雄相册.mp4"));

    byte[] bys = new byte[1024];
    int len;
    while ((len = bis.read(bys)) != -1) {
      bos.write(bys, 0, len);
    }

    bos.close();
    bis.close();
  }
}
